/**********************************************************************
*file:任意帧收发
*author:残梦
*versions:V2.2
*date:2024.3.20
*note:
添加CRC校验函数
格式规定：
帧标识A	类型	备注
A<=0x80	短帧	数据长度1字节
A>0x80	长帧	数据长度2字节

短帧:帧标识 帧标识取反 帧用户数据字节数									用户数据...用户数据
长帧:帧标识 帧标识取反 帧用户数据字节数(高8位) 帧用户数据字节数(低8位)  用户数据...用户数据
注意:
帧标识符应尽量避免使用0x00/0xFF,因为出现概率过高，容易误识别

使用方法：

#include "stdio.h"
#include "stdint.h"
#include "math.h"
#include "frame_driver.h"

#define dDATA_SIZE 65537
int main()
{
	//自定义短帧内容
	uint8_t data[dDATA_SIZE] = { 0x01,0x00,0x03,0x01,0x00,\
	0x01,dIdentify_Invert(0x01),0x01,0x0A,\
	0x02,0x03,0x01,
	0x01, dIdentify_Invert(0x01),0x05,0x01,0x02,0x03,0x04,0x05,\
		0x01, 0x00, 0x03, 0x01, 0x00, \
	0x01, dIdentify_Invert(0x01),0x02,0x01,0x02,\
		0x01, 0x00, 0x03, 0x01, 0x00, \

	0x01, dIdentify_Invert(0x01),0x03,0x01,0x02,0x03,\
		0x01, 0x00, 0x03, 0x01, 0x00, \
	0x02, dIdentify_Invert(0x02), 0x05, 0x01, 0x02, 0x03, 0x04, 0x05, \
		0x01, 0x00, 0x03, 0x01, 0x00, \
	0x03, dIdentify_Invert(0x03), 0x02, 0x01, 0x02, \
		0x01, 0x00, 0x03, 0x01, 0x00, \
	0x04, dIdentify_Invert(0x04), 0x03, 0x01, 0x02, 0x03, \
		0x01, 0x00, 0x03, 0x01, 0x00, \
	0x05, dIdentify_Invert(0x05), 0x03, 0x01, 0x02, 0x03, \
	0x81, dIdentify_Invert(0x81), dDataLength_MSB(2), dDataLength_LSB(2),0x0A,0x0B\
	};
	uint8_t data2[dDATA_SIZE];
	uint32_t i = 0, j = 0, num = 0;

	i = 0;
	data2[i++] = 0x81;//定义长帧内容
	data2[i++] = dIdentify_Invert(0x81);
	data2[i++] = dDataLength_MSB(dDATA_SIZE - 4);
	data2[i++] = dDataLength_LSB(dDATA_SIZE - 4);
	for (j = 0; j < dDATA_SIZE - 4; j++)data2[i++] = j % 0x0FF;

	frame_handler frame;
	if (frame_init(&frame, 5, dDATA_SIZE) < 0)return 0;创建5个帧资源，最大帧长度为dDATA_SIZE
	if (frame_identify_add(&frame, 0x01) < 0)return 0;//添加标识符0x01帧
	if (frame_identify_add(&frame, 0x02) < 0)return 0;
	if (frame_identify_add(&frame, 0x03) < 0)return 0;
	if (frame_identify_add(&frame, 0x04) < 0)return 0;
	if (frame_identify_add(&frame, 0x81) < 0)return 0;
	frame_identify_add(&frame, 0x05);//超过帧资源添加0x05标识符帧失败

	for (i = 0; i < dDATA_SIZE; i++)//查找长帧
	{
		if (frame_find(&frame, data2[i]) < 0)continue;//帧识别
		frame_data_printf(frame.data_rx);//有效帧打印输出
	}

	for (i = 0; i < dDATA_SIZE; i++)//查找短帧
	{
		if (frame_find(&frame, data[i]) < 0)continue;
		frame_data_printf(frame.data_rx);
	}

	//中途放弃之前的查找
	//for (i = 0; i < dDATA_SIZE; i++)//查找长帧
	//{
	//	if (i == 4)frame_find_clear(&frame);//清空查找器
	//	if (frame_find(&frame, data2[i]) < 0)continue;//帧识别
	//	frame_data_printf(frame.data_rx);//有效帧打印输出
	//}

	frame_DeInit(&frame);//销毁帧资源


	uint8_t *pdata = NULL, send[6] = {0};
	pdata = frame_format_generate(0x0A, 2, send);//生成帧格式:0x0A 0xF5 0x02 0x00 0x00
	if (pdata == NULL)printf("生成失败\n");
	else
	{
		for (i = 0; i < 5; i++)printf("0x%0X,", send[i]);
		printf("\n");
	}

	pdata = frame_format_generate(0x1A, 2, send);//生成帧格式:0x0A 0xE5 0x00 0x02 0x00 0x00
	if (pdata == NULL)printf("生成失败\n");
	else
	{
		for (i = 0; i < 6; i++)printf("0x%0X,", send[i]);
		printf("\n");
	}
	return 0;
}

示例2：
#define BufferSize 4076
void main()
{
    uint8_t buf[] = {\
0x81,0x7E,0x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38,0x91,0x07,0x3F,0x16,0x4C,0x07,0x3F,0x2D,0x08,0x07,0x3F,0x7C,0xC5,0x06,0x3F,0x05,0x84,0x06,0x3F,0xC8,0x43,0x06,0x3F,0xC6,0x04,0x06,0x3F,0x00,0xC7,0x05,0x3F,0x76,0x8A,0x05,0x3F,0x29,0x4F,0x05,0x3F,0x19,0x15,0x05,0x3F,0x47,0xDC,0x04,0x3F,0xB4,0xA4,0x04,0x3F,0x60,0x6E,0x04,0x3F,0x4C,0x39,0x04,0x3F,0x78,0x05,0x04,0x3F,0xE4,0xD2,0x03,0x3F,0x92,0xA1,0x03,0x3F,0x82,0x71,0x03,0x3F,0xB4,0x42,0x03,0x3F,0x29,0x15,0x03,0x3F,0xE1,0xE8,0x02,0x3F,0xDD,0xBD,0x02,0x3F,0x1C,0x94,0x02,0x3F,0xA0,0x6B,0x02,0x3F,0x69,0x44,0x02,0x3F,0x78,0x1E,0x02,0x3F,0xCC,0xF9,0x01,0x3F,0x66,0xD6,0x01,0x3F,0x47,0xB4,0x01,0x3F,0x6E,0x93,0x01,0x3F,0xDC,0x73,0x01,0x3F,0x92,0x55,0x01,0x3F,0x8F,0x38,0x01,0x3F,0xD5,0x1C,0x01,0x3F,0x63,0x02,0x01,0x3F,0x39,0xE9,0x00,0x3F,0x58,0xD1,0x00,0x3F,0xC1,0xBA,0x00,0x3F,0x72,0xA5,0x00,0x3F,0x6D,0x91,0x00,0x3F,0xB2,0x7E,0x00,0x3F,0x40,0x6D,0x00,0x3F,0x19,0x5D,0x00,0x3F,0x3C,0x4E,0x00,0x3F,0xA9,0x40,0x00,0x3F,0x61,0x34,0x00,0x3F,0x63,0x29,0x00,0x3F,0xB0,0x1F,0x00,0x3F,0x48,0x17,0x00,0x3F,0x2B,0x10,0x00,0x3F,0x59,0x0A,0x00,0x3F,0xD2,0x05,0x00,0x3F,0x96,0x02,0x00,0x3F,0xA6,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0xA6,0x00,0x00,0x3F,0x96,0x02,0x00,0x3F,0xD2,0x05,0x00,0x3F,0x59,0x0A,0x00,0x3F,0x2B,0x10,0x00,0x3F,0x48,0x17,0x00,0x3F,0xB0,0x1F,0x00,0x3F,0x63,0x29,0x00,0x3F,0x81,0x7E,0x03,0xCC,0x00,0x04,0x00,0x00,0xF1,0x00,0xF7,0x02,0x61,0x34,0x00,0x3F,0xA9,0x40,0x00,0x3F,0x3C,0x4E,0x00,0x3F,0x19,0x5D,0x00,0x3F,0x40,0x6D,0x00,0x3F,0xB2,0x7E,0x00,0x3F,0x6D,0x91,0x00,0x3F,0x72,0xA5,0x00,0x3F,0xC0,0xBA,0x00,0x3F,0x58,0xD1,0x00,0x3F,0x39,0xE9,0x00,0x3F,0x63,0x02,0x01,0x3F,0xD5,0x1C,0x01,0x3F,0x8F,0x38,0x01,0x3F,0x92,0x55,0x01,0x3F,0xDC,0x73,0x01,0x3F,0x6E,0x93,0x01,0x3F,0x46,0xB4,0x01,0x3F,0x66,0xD6,0x01,0x3F,0xCC,0xF9,0x01,0x3F,0x78,0x1E,0x02,0x3F,0x69,0x44,0x02,0x3F,0xA0,0x6B,0x02,0x3F,0x1C,0x94,0x02,0x3F,0xDC,0xBD,0x02,0x3F,0xE1,0xE8,0x02,0x3F,0x29,0x15,0x03,0x3F,0xB4,0x42,0x03,0x3F,0x82,0x71,0x03,0x3F,0x92,0xA1,0x03,0x3F,0xE4,0xD2,0x03,0x3F,0x77,0x05,0x04,0x3F,0x4B,0x39,0x04,0x3F,0x60,0x6E,0x04,0x3F,0xB4,0xA4,0x04,0x3F,0x47,0xDC,0x04,0x3F,0x19,0x15,0x05,0x3F,0x28,0x4F,0x05,0x3F,0x75,0x8A,0x05,0x3F,0xFF,0xC6,0x05,0x3F,0xC6,0x04,0x06,0x3F,0xC7,0x43,0x06,0x3F,0x04,0x84,0x06,0x3F,0x7B,0xC5,0x06,0x3F,0x2C,0x08,0x07,0x3F,0x16,0x4C,0x07,0x3F,0x38,0x91,0x07,0x3F,0x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,0xCE,0x68,0x3F,0xD7,0x98,0x69,0x3F,0xAA,0x63,0x6A,0x3F,0xB4,0x2E,0x6B,0x3F,0xF4,0xF9,0x6B,0x3F,0x68,0xC5,0x6C,0x3F,0x0D,0x91,0x6D,0x3F,0xE2,0x5C,0x6E,0x3F,0xE5,0x28,0x6F,0x3F,0x14,0xF5,0x6F,0x3F,0x6C,0xC1,0x70,0x3F,0xEB,0x8D,0x71,0x3F,0x90,0x5A,0x72,0x3F,0x58,0x27,0x73,0x3F,0x41,0xF4,0x73,0x3F,0x4A,0xC1,0x74,0x3F,0x6F,0x8E,0x75,0x3F,0xB0,0x5B,0x76,0x3F,0x0A,0x29,0x77,0x3F,0x7A,0xF6,0x77,0x3F,0xFF,0xC3,0x78,0x3F,0x97,0x91,0x79,0x3F,0x40,0x5F,0x7A,0x3F,0xF7,0x2C,0x7B,0x3F,0xBB,0xFA,0x7B,0x3F,0x89,0xC8,0x7C,0x3F,0x5F,0x96,0x7D,0x3F,0x3C,0x64,0x7E,0x3F,0x1C,0x32,0x7F,0x3F,
0x01,0xFE,0x0A,0x00,0x04,0x01,0x01,0x00,0x00,0x20,0x42,0xE8,0x00,
0x01,0xFE,0x03,0x00,0x04,0x02,
0x01,0xFE,0x03,0x00,0x02,0x01,
0x01,0xFE,0x00
};
    uint16_t i = 0,num = 0;
    frame_handler frame;

    if(frame_init(&frame,2,1024+4) < 0){printf("Failed to initialize...\n");return;}
    frame_identify_add(&frame,0x01);
    frame_identify_add(&frame,0x81);

    for(i = 0;i < BufferSize;i++)
    {
        if(frame_find(&frame,buf[i]) < 0)continue;
        frame_data_printf(frame.data_rx);
		num++;
		printf("\r\n\n\n");
    }
	printf("num=%d\r\n",num);
    frame_DeInit(&frame);
}

**********************************************************************/
#include "frame_driver.h"
#include "stdlib.h"
#include "string.h"

static int frame_identify_find(Frame_Identify_StructDef identify, uint8_t id);

/****************************************
@function:匹配帧标识符集合
@param:identify--标识符集合
	id--待匹配的标识符
@return:-1--失败,0--成功
@note:
****************************************/
static int frame_identify_find(Frame_Identify_StructDef identify, uint8_t id)
{
	uint8_t i = 0;

	for (i = 0; i < identify.pos; i++)
	{
		if (identify.pbuf[i] == id)return 0;
	}
	return -1;
}

/****************************************
@function:帧资源初始化
@param:p--帧句柄
	number--帧种类数,范围[1,255]
	rx_size--帧接收缓冲区字节数,等于最大帧长度,范围[4,uint32_t]
@return:
	0--成功
	-1:参数错误
	-2:内存分配失败
@note:
****************************************/
int frame_init(frame_handler *p, uint8_t number, uint32_t rx_size)
{
	if ((p == NULL) || (number == 0) || (rx_size < 4))return -1;
	p->state = 0;
	p->identify.pbuf = (uint8_t *)malloc(number);
	if (p->identify.pbuf == NULL)
	{
		dFrame_LOG("Error[%s-line:%d]:memory allocation failure\n", __func__, __LINE__);
		return -2;
	}
	p->identify.number = number;
	p->identify.pos = 0;

	p->rx.pbuf = (uint8_t *)malloc(rx_size);
	if (p->rx.pbuf == NULL)
	{
		frame_DeInit(p);
		dFrame_LOG("Error[%s-line:%d]:memory allocation failure\n", __func__, __LINE__);
		return -2;
	}
	p->rx.size = rx_size;
	p->rx.pos = 0;

	p->data_rx.state = eFrame_State_ID;
	p->data_rx.identify = 0;
	p->data_rx.size = 0;
	p->data_rx.pbuf = NULL;

	p->state = 1;
	return 0;
}

/****************************************
@function:帧资源销毁
@param:p--帧句柄
@return:void
@note:
****************************************/
void frame_DeInit(frame_handler *p)
{
	if (p == NULL)return;
	p->state = 0;
	if (p->identify.pbuf != NULL)free(p->identify.pbuf);
	p->identify.pbuf = NULL;
	p->identify.number = 0;
	p->identify.pos = 0;
	if (p->rx.pbuf != NULL)free(p->rx.pbuf);
	p->rx.pbuf = NULL;
	p->rx.size = 0;
	p->rx.pos = 0;

	p->data_rx.state = eFrame_State_ID;
	p->data_rx.identify = 0;
	p->data_rx.size = 0;
	p->data_rx.pbuf = NULL;
}

/****************************************
@function:添加待查找的帧标识
@param:p--帧句柄
	identify--帧标识
		格式规定：
		帧标识	类型	备注
		A<=0x80	短帧	数据长度1字节
		A>0x80	长帧	数据长度2字节

		短帧:帧标识 帧标识取反 数据字节数 数据...数据
		长帧:帧标识 帧标识取反 数据字节数(高8位) 数据字节数(低8位) 数据...数据
@return:
	0:成功
	-1--参数错误
	-2:添加失败
@note:添加重复帧标识无效
****************************************/
int frame_identify_add(frame_handler *p, uint8_t identify)
{
	uint8_t i = 0;
	if (p == NULL)return -1;
	if (p->state == 0)return -1;
	if (p->identify.pos >= p->identify.number)return -2;
	while (i < p->identify.pos)
	{
		if (p->identify.pbuf[i++] == identify)return -2;
	}
	p->identify.pbuf[p->identify.pos++] = identify;
	return 0;
}

/****************************************
@function:数据接收并匹配帧集合
@param:p--帧句柄
	data--新数据
@return:
	0:识别到帧数据,数据信息查看p->data_rx结构体
	-1:参数异常|帧未初始化
	-2:检索ID阶段
	-3:检索帧数据字节数阶段
	-4:数据接收阶段
	-5:帧数据为0字节(空帧)
	-6:接收缓冲区空间不足,原因：初始化的帧资源大小低于帧总长度
@note:
****************************************/
int frame_find(frame_handler *p, uint8_t data)
{
	uint16_t len = 0;
	if (p == NULL)return -1;
	if (p->state == 0)return -1;
	if (p->identify.pos == 0)return -1;//没有待识别的帧标识 

	if(p->rx.pos >= p->rx.size)//超过接收帧创建长度
	{
		p->rx.pos = 0;
		p->data_rx.state = eFrame_State_ID;
		return -6;
	}
	p->rx.pbuf[p->rx.pos++] = data;

	switch (p->data_rx.state)
	{
		case eFrame_State_ID:
		{
			if(p->rx.pos < 2)return -2;
			if ((p->rx.pbuf[p->rx.pos - 2] != dIdentify_Invert(p->rx.pbuf[p->rx.pos - 1]))\
				|| (frame_identify_find(p->identify,p->rx.pbuf[p->rx.pos - 2]) != 0)
			)//帧标识不对
			{
				//数据移除1字节
				memmove((void *)(&(p->rx.pbuf[p->rx.pos - 2])),(void *)(&(p->rx.pbuf[p->rx.pos - 1])),1);
				p->rx.pos--;
				return -2;
			}

			p->data_rx.state = eFrame_State_Bytes;
			return -3;
		}
		case eFrame_State_Bytes:
		{
			if(p->rx.pbuf[0] <= 0x80)//短帧
			{
				if(p->rx.pbuf[p->rx.pos - 1] == 0)//帧数据字节数为0
				{
					p->rx.pos = 0;
					p->data_rx.state = eFrame_State_ID;
					return -5;
				}

				p->data_rx.identify = p->rx.pbuf[0];
				p->data_rx.size = p->rx.pbuf[p->rx.pos - 1];
				p->data_rx.pbuf = &(p->rx.pbuf[p->rx.pos]);
				p->data_rx.state = eFrame_State_Receive;
				return -4;
			}

			//长帧
			if(p->rx.pos < 4)return -3;
			len = dDataLength_Merge(p->rx.pbuf[p->rx.pos - 2], p->rx.pbuf[p->rx.pos - 1]);
			if(len == 0)//帧数据字节数为0
			{
				p->rx.pos = 0;
				p->data_rx.state = eFrame_State_ID;
				return -5;
			}

			p->data_rx.identify = p->rx.pbuf[0];
			p->data_rx.size = len;
			p->data_rx.pbuf = &(p->rx.pbuf[p->rx.pos]);
			p->data_rx.state = eFrame_State_Receive;
			return -4;
		}
		case eFrame_State_Receive:
		{
			len = (p->data_rx.identify > 0x80) ? (p->rx.pos - 4) : (p->rx.pos - 3);
			if(len < p->data_rx.size)return -4;
			p->rx.pos = 0;
			p->data_rx.state = eFrame_State_ID;
			return 0;
		}
	}
	return -1;
}

/****************************************
@function:帧查找器清空
@param:p--帧句柄
@return:void
@note:
****************************************/
int frame_find_clear(frame_handler *p)
{
	if (p == NULL)return -1;
	if (p->state == 0)return -1;

	p->rx.pos = 0;
	p->data_rx.state = eFrame_State_ID;
	p->data_rx.identify = 0;
	p->data_rx.size = 0;
	p->data_rx.pbuf = NULL;
	return 0;
}

/****************************************
@function:帧接收信息打印
@param:data--接收到的帧数据
@return:void
@note:
****************************************/
void frame_data_printf(Frame_Data_StructDef data)
{
	uint32_t i = 0;

	dFrame_LOG("Identify=0x%0X size=%d", data.identify, data.size);
	for (i = 0; i < data.size; i++)
	{
		if (i == 0)dFrame_LOG(" data{0x%0x", data.pbuf[i]);
		else dFrame_LOG(",0x%0x", data.pbuf[i]);
	}
	if (i != 0)dFrame_LOG("}\n");
	else dFrame_LOG("\n");
}

/****************************************
@function:生成帧格式
@param:identify--帧标识符
	size--帧用户数据字节数，不能为0
	pbuf--帧缓冲区，生成的帧数据放置在此缓冲区，起始位置pbuf[0]
@return:
	NULL:生成失败，参数错误
	！NULL:帧用户数据起始地址
@note:
	注意生成的帧总长度为：
	短帧(identify <= 0x80):(size+3)字节
	长帧(identify > 0x80):(size+4)字节
	此函数会清0缓冲区
****************************************/
uint8_t *frame_format_generate(uint8_t identify, uint32_t size, uint8_t *pbuf)
{
	if ((pbuf == NULL) || (size < 1))return NULL;
	memset(pbuf, 0, (size + ((identify > 0x80) ? 4 : 3)));
	pbuf[0] = identify;
	pbuf[1] = dIdentify_Invert(identify);
	if (identify > 0x80)
	{
		pbuf[2] = dDataLength_MSB(size);
		pbuf[3] = dDataLength_LSB(size);
		return &pbuf[4];
	}
	pbuf[2] = size;
	return (&pbuf[3]);
}

static const uint8_t __auchCRCHi[256] = {
    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
    0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
    0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01,
    0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81,
    0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
    0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01,
    0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
    0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
    0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01,
    0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
    0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
    0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01,
    0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81,
    0x40
};
static const uint8_t __auchCRCLo[256] = {
    0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4,
    0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09,
    0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD,
    0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
    0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, 0x36, 0xF6, 0xF7,
    0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A,
    0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE,
    0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
    0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2,
    0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F,
    0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB,
    0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
    0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, 0x50, 0x90, 0x91,
    0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C,
    0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88,
    0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
    0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80,
    0x40
};

/****************************************************
@function:CRC16计算
@param:data--待校验数据
    len-数据长度
@return:计算结果
@note:
****************************************************/
uint16_t frame_CRC16_ParityGet(uint8_t *data, uint16_t len)
{
    uint8_t uchCRCHi = 0xFF,uchCRCLo = 0xFF;
    uint16_t i = 0,uIndex = 0;

    uchCRCHi = 0xFF;
    uchCRCLo = 0xFF;
    for (i = 0; i<len; i++)
    {
        uIndex = uchCRCHi ^ data[i];
        uchCRCHi = uchCRCLo ^ __auchCRCHi[uIndex];
        uchCRCLo = __auchCRCLo[uIndex] ;
    }
    return (uint16_t)(((uint16_t)uchCRCHi << 8) | (uint16_t)uchCRCLo) ;
}

/****************************************************
@function:校验和计算
@param:data--待校验数据
    len-数据长度
@return:计算结果
@note:
****************************************************/
uint8_t frame_ChecksumGet(uint8_t *data, uint16_t len)
{
    uint8_t checksum = 0;
    for (uint16_t i = 0; i < len; i++)checksum += data[i];
    return checksum;
}

